Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
profiling_writer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Roc authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_audio/profiling_writer.h
10//! @brief Profiling writer.
11
12#ifndef ROC_AUDIO_PROFILING_WRITER_H_
13#define ROC_AUDIO_PROFILING_WRITER_H_
14
15#include "roc_audio/iwriter.h"
18#include "roc_core/time.h"
19#include "roc_packet/units.h"
20
21namespace roc {
22namespace audio {
23
24//! Profiling writer.
25class ProfilingWriter : public IWriter, public core::NonCopyable<> {
26public:
27 //! Initialization.
28 ProfilingWriter(IWriter& writer, packet::channel_mask_t channels, size_t sample_rate);
29
30 //! Write audio frame.
31 virtual void write(Frame& frame);
32
33private:
34 core::nanoseconds_t write_(Frame& frame);
35 void update_(double speed);
36
37 IWriter& writer_;
38
39 core::RateLimiter rate_limiter_;
40
41 double avg_speed_;
42 double avg_len_;
43
44 const size_t sample_rate_;
45 const size_t num_channels_;
46};
47
48} // namespace audio
49} // namespace roc
50
51#endif // ROC_AUDIO_PROFILING_WRITER_H_
Audio frame.
Definition: frame.h:22
Audio writer interface.
Definition: iwriter.h:21
ProfilingWriter(IWriter &writer, packet::channel_mask_t channels, size_t sample_rate)
Initialization.
virtual void write(Frame &frame)
Write audio frame.
Base class for non-copyable objects.
Definition: noncopyable.h:23
int64_t nanoseconds_t
Nanoseconds.
Definition: time.h:21
uint32_t channel_mask_t
Bitmask of channels present in audio packet.
Definition: units.h:77
Root namespace.
Non-copyable object.
Rate limiter.
Audio writer interface.
Various units used in packets.
Time definitions.